feat: calculate balanced values based on form#978
Merged
DanielSchiavini merged 7 commits intomainfrom May 26, 2025
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Closed
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR extends deposit functionality to support balanced amount calculations driven by user form inputs in addition to existing wallet-based balances.
- Introduces a new union type for
isBalancedAmountsto distinguish between wallet-based, form-based, or disabled modes. - Implements
calculateBalancedValuesinFieldsDeposit.tsxto recalculate token proportions when a single input changes. - Updates logging in
curvejs.tsand bumps the@curvefi/apidependency.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/main/src/dex/store/createPoolDepositSlice.ts | Refine isBalancedAmounts check to only trigger on 'by-wallet' and type-annotate resetFormValues. |
| apps/main/src/dex/lib/curvejs.ts | Change log call to wrap isWrapped in an object. |
| apps/main/src/dex/components/PagePool/Deposit/types.ts | Change isBalancedAmounts from boolean to `'by-wallet' |
| apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx | Add calculateBalancedValues, update form‐change handler, and adapt checkbox logic. |
| apps/main/package.json | Bump @curvefi/api from 2.66.26 to 2.66.28. |
Comments suppressed due to low confidence (3)
apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx:85
- [nitpick] The variable
isBalancedAmountsnow holds a string union orfalse, which can be confusing. Consider renaming tobalanceModeor similar to reflect its multi-state nature.
const isBalancedAmounts = formValues.isBalancedAmounts
apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx:30
- Add unit tests for
calculateBalancedValuesto verify correct proportion calculations and edge cases (e.g., zero balances or missing price data).
function calculateBalancedValues(
apps/main/src/dex/lib/curvejs.ts:476
- The
logcall signature was changed from passing a boolean to wrappingisWrappedin an object. Verify that downstream log parsers and monitoring tools handle this new shape as expected.
log('depositBalancedAmounts', p.name, { isWrapped })
apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx
Show resolved
Hide resolved
mimaklas
previously approved these changes
May 23, 2025
0xAlunara
reviewed
May 23, 2025
apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx
Show resolved
Hide resolved
OnlyJousting
approved these changes
May 23, 2025
0xtutti
approved these changes
May 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.